from django.shortcuts import render
from django.urls import path, re_path

import product.src.product
from product.src import product
from django.urls import *
from django.http import *
import json


# Create your views here.

def get_layout(req: HttpRequest, product_name, block_name):
    block = product.Product(product_name).get_block_info(block_name)
    # print(product_name, block_name)
    # j = json.dumps(block)
    # return HttpResponse(j)
    return JsonResponse(block)


def show_layout(req: HttpRequest, product_name, block_name):
    return render(req, 'product/block.html', {'product_name': product_name,
                                              'block_name': block_name})
